package io.framework.modules.air.controller;

import io.framework.common.page.PageData;
import io.framework.common.utils.Result;
import io.framework.modules.air.entity.AirCarAutoDataEntity;
import io.framework.modules.air.service.AirCarAutoDataService;
import io.framework.modules.water.entity.WaterAutoDataEntity;
import io.framework.modules.water.service.WaterAutoDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;


/**
 * 水环境管理接口
 *
 * @author Gujq email
 * @since 1.0.0 2020-05-22
 */
@RestController
@Api(tags = "汽车尾气接口")
public class AirCarAutoDataController {




    @Autowired
    private AirCarAutoDataService airCarAutoDataService;


    @GetMapping("air/getAirCarAutoListByParams")
    @ApiOperation("汽车尾气")
    public Result<PageData<AirCarAutoDataEntity>> getWaterAutoListByParams(@RequestParam Map<String, Object> params) {


        PageData<AirCarAutoDataEntity> page = airCarAutoDataService.getAirCarAutoListByParams(params);
        return new Result<PageData<AirCarAutoDataEntity>>().ok(page);



    }


    @GetMapping("air/info/getAirCarAutoDataMonthChange")
    @ApiOperation("站点污染物浓度月度变化")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dateType", value = "1-年度 2-季度 3-月份", paramType = "query", dataType = "String", required = true),
            @ApiImplicitParam(name = "date", value = "年 2020、季 2020-Q1 2020-Q2 2020-Q3 2020-Q4、月 2020-04", paramType = "query", dataType = "String", required = true),
            @ApiImplicitParam(name = "stationName", value = "断面名称", paramType = "query", dataType = "String", required = true),
            @ApiImplicitParam(name = "factor", value = "因子 PH、YD-盐度、DOO2-溶解氧、COD-化学需氧量、H2PO4-活性磷酸盐、OIL-石油类、Nmin-无机氮、K2MnO4-高锰酸钾、NH3-氨氮、TP-总磷、TN-总氮", paramType = "query", dataType = "String", required = true),
    })
    public Result<List<Map<String, Object>>> getAirCarAutoDataMonthChange(@ApiIgnore @RequestParam Map<String, Object> params) {
        List<Map<String, Object>> mapList = airCarAutoDataService.getAirCarAutoDataMonthChange(params);

        return new Result<List<Map<String, Object>>>().ok(mapList);
    }


    @GetMapping("air/info/airCarAutoDataRate")
    @ApiOperation("站点水质现状类别占比")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "1-地表水 2-城镇内河 3-重点治理城镇内河（湖） 4-饮用水源", paramType = "query", dataType = "String", required = true),
            @ApiImplicitParam(name = "date", value = "时间 2020-5", paramType = "query", dataType = "String", required = true)
    })
    public Result<Map<String, Object>> airCarAutoDataRate(@ApiIgnore @RequestParam Map<String, Object> params) {

        Map<String, Object> map = airCarAutoDataService.getAirCarAutoDataRateInfo(params);

        return new Result<Map<String, Object>>().ok(map);
    }




}